package com.andy.eqm.server.game;

import java.io.Serializable;

import com.andy.eqm.server.dao.DaoUtils;
import com.andy.eqm.server.entity.UsrGameInfo;
import com.andy.eqm.server.entity.UsrUser;
import com.andy.eqm.server.utils.CommonUtils;

public class GameUser implements Serializable{

	private static final long serialVersionUID = 1L;

	private int status;
	private UsrUser user;
	private UsrGameInfo gameInfo;
	
	public GameUser() {
	}
	
	public GameUser(UsrUser user) {
		this.setUser(user);
	}
	
	public String getUserName() {
		return user.getUserName();
	}

	public String getNickName() {
		return user.getNickName();
	}

	public UsrUser getUser() {
		return user;
	}

	public void setUser(UsrUser user) {
		this.user = user;
	}

	public UsrGameInfo getGameInfo() {
		return gameInfo;
	}

	public void setGameInfo(UsrGameInfo gameInfo) {
		this.gameInfo = gameInfo;
	}

	public Long getId() {
		return user.getId();
	}

	/**
	 * 增减物品
	 * @param itemId
	 * @param size
	 */
	public void addItem(int itemId,int size) {
		gameInfo.addItem(itemId, size);
		CommonUtils.saveDb(gameInfo);
	}

}
